package cn.buk.tms.entity.misc;

import java.util.Date;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.persistence.Temporal;
import jakarta.persistence.TemporalType;

/**
 * Created by yfdai on 16/10/27.
 * 航司退改签收费标准
 */
@Entity
@Table(name = "fare_condition")
public class FareCondition {

    @Id
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    private int id;

    @Column(name = "enterprise_id")
    private int enterpriseId;

    @Column(length = 2, nullable = false)
    private String carrier;

    @Column(length = 2, nullable = false)
    private String subclass;

    /**
     * 是否允许open
     * 0 - 不允许
     * 1 - 允许
     */
    @Column(name = "open_allowed")
    private int openAllowed;

    /**
     * 自愿签转规则
     */
    @Column(name = "endorsement_rule", length = 50)
    private String endorsementRule;

    /**
     * 航前自愿变更手续费
     * 0 - 免费
     * 数字 - 百分比
     */
    @Column(name = "reroute_rule_before")
    private int rerouteRuleBefore;

    /**
     * 航后自愿变更手续费
     */
    @Column(name = "reroute_rule_after")
    private int rerouteRuleAfter;

    /**
     * 航前自愿退票手续费
     */
    @Column(name = "refund_rule_before")
    private int refundRuleBefore;

    /**
     * 航后
     */
    @Column(name = "refund_rule_after")
    private int refundRuleAfter;

    /**
     * 以航前2小时为 航前、航后的分界点，不同航司可能会不同
     */
    @Column(name = "time_node_before")
    private int timeNodeBeforeDeparture = 2;


    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "create_time", insertable = false, updatable = false)
    private Date createTime;

    @Temporal(TemporalType.TIMESTAMP)
    @Column(insertable = false)
    private Date lastupdate;




    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getEnterpriseId() {
        return enterpriseId;
    }

    public void setEnterpriseId(int enterpriseId) {
        this.enterpriseId = enterpriseId;
    }

    public String getCarrier() {
        return carrier;
    }

    public void setCarrier(String carrier) {
        if (carrier == null) {
          carrier = "";
        } else {
          carrier = carrier.trim().toUpperCase();
        }

        this.carrier = carrier;
    }

    public String getSubclass() {
        return subclass.trim();
    }

    public void setSubclass(String subclass) {
        if (subclass == null) {
          subclass = "";
        } else {
          subclass = subclass.trim().toUpperCase();
        }

        this.subclass = subclass;
    }



    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getLastupdate() {
        return lastupdate;
    }

    public void setLastupdate(Date lastupdate) {
        this.lastupdate = lastupdate;
    }

    public int getOpenAllowed() {
        return openAllowed;
    }

    public void setOpenAllowed(int openAllowed) {
        this.openAllowed = openAllowed;
    }

    public String getEndorsementRule() {
        return endorsementRule;
    }

    public void setEndorsementRule(String endorsementRule) {
        this.endorsementRule = endorsementRule;
    }

    public int getRerouteRuleBefore() {
        return rerouteRuleBefore;
    }

    public void setRerouteRuleBefore(int rerouteRuleBefore) {
        this.rerouteRuleBefore = rerouteRuleBefore;
    }

    public int getRerouteRuleAfter() {
        return rerouteRuleAfter;
    }

    public void setRerouteRuleAfter(int rerouteRuleAfter) {
        this.rerouteRuleAfter = rerouteRuleAfter;
    }

    public int getRefundRuleBefore() {
        return refundRuleBefore;
    }

    public void setRefundRuleBefore(int refundBefore) {
        this.refundRuleBefore = refundBefore;
    }

    public int getRefundRuleAfter() {
        return refundRuleAfter;
    }

    public void setRefundRuleAfter(int refundAfter) {
        this.refundRuleAfter = refundAfter;
    }

    public int getTimeNodeBeforeDeparture() {
        return timeNodeBeforeDeparture;
    }

    public void setTimeNodeBeforeDeparture(int timeNodeBeforeDeparture) {
        this.timeNodeBeforeDeparture = timeNodeBeforeDeparture;
    }
}
